package com.edu.aspect;
/*
 * @Author:princess
 * @Date 2023/11/2 11 02 9:50
 *
 */

import com.edu.bean.Goods;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAspect {
    @Around("execution(* com.edu.service.impl.GoodsServiceImpl.*(..))")
    public Object around(ProceedingJoinPoint jt) throws Throwable {
        System.out.println(jt.getSignature().getName()+"已执行");
        long start = System.currentTimeMillis();
        Object result = jt.proceed();
        long end = System.currentTimeMillis();
        System.out.println("耗时："+(end-start));
        return result;
    }
}
